package Work4.Slay_the_Maze.Monsters;

import java.util.Random;
import Work4.Slay_the_Maze.Player.Player;

public class Goblin extends Monster{
	public Goblin() {
		super("哥布林",30);
	}
	public Goblin(Goblin other) {
        // 调用父类的构造函数，复制父类属性
        super(other.getName(), other.getHP());
    }

    // 克隆方法
    @Override
    public Monster clone() {
        return new Goblin(this);  // 使用拷贝构造函数
    }
    @Override
    public void Action(Player player,Monster monster) {
        int temp;
        Random rd=new Random();
        temp=rd.nextInt(100)+1;
        if(temp>=1&&temp<=90) {
        	int attnum=attack(player);
        	System.out.println("哥布林使用肘击，造成"+attnum+"伤害");
        }else if(temp>90&&temp<=100){
        	int attnum=attack(player);
        	player.damage(attnum);
        	attnum=attnum*2;
        	System.out.println("哥布林使用肘击，暴击了！造成"+attnum+"伤害");
        }
    }
    @Override
    public int attack(Player target) {
        Random rd=new Random();
        int attnum=rd.nextInt(11)+10;
        target.damage(attnum);
        return attnum;
    }

}
